The HealthCorrelation
class represents a group of health samples that are logically related. It provides an interface for accessing and creating correlation records that group multiple health data types together—such as combining dietary intake and blood pressure readings, or linking ovulation tests with menstrual flow records.
Property Name | Type | Description |
---|---|---|
uuid |
string |
A unique identifier for the correlation sample. |
correlationType |
HealthCorrelationType |
The type of the correlation, such as "bloodPressure" or "food" . |
startDate |
Date |
The start time of the correlation event. |
endDate |
Date |
The end time of the correlation event. |
metadata |
Record<string, any> | null |
Optional metadata associated with the correlation, such as user annotations. |
samples |
(HealthQuantitySample | HealthCumulativeQuantitySample | HealthDiscreteQuantitySample | HealthCategorySample)[] |
All samples included in this correlation. |
quantitySamples |
HealthQuantitySample[] |
A convenience array of all quantity-based samples. |
cumulativeQuantitySamples |
HealthCumulativeQuantitySample[] |
A filtered array of only cumulative quantity samples. |
discreteQuantitySamples |
HealthDiscreteQuantitySample[] |
A filtered array of only discrete quantity samples. |
categorySamples |
HealthCategorySample[] |
A filtered array of all category-based samples. |
HealthCorrelation.create(options): HealthCorrelation | null
Creates a new correlation with one or more health samples.
Parameter | Type | Required | Description |
---|---|---|---|
type |
HealthCorrelationType |
Yes | The correlation type, e.g., "bloodPressure" or "food" . |
startDate |
Date |
Yes | The start time of the correlation. |
endDate |
Date |
Yes | The end time of the correlation. |
metadata |
Record<string, any> | null |
No | Optional metadata to store alongside the correlation. |
objects |
(HealthQuantitySample | HealthCategorySample)[] |
Yes | The array of health samples to associate in the correlation. |
HealthCorrelation
instance if the parameters are valid.null
if the type and samples are incompatible or validation fails.HealthCorrelationType
."bloodPressure"
and "food"
.